<?php
namespace app\api\model;

use app\common\model\Page as PageModel;
use app\common\exception\BaseException;
/**
 * 单页模型
 * Class Page
 * @package app\api\model
 */
class Page extends PageModel
{
    /**
     * 单页详情：HTML实体转换回普通字符
     * @param $value
     * @return string
     */
    public function getPageContentAttr($value)
    {
        return htmlspecialchars_decode($value);
    }

    /**
     * 单页详情
     * @param $page_id
     * @throws \think\Exception
     * @throws \think\exception\DbException
     */
    public static function detail($page_id)
    {
        if (!$model = parent::detail($page_id)) {
            throw new BaseException(['msg' => '单页不存在']);
        }
        return $model;
    }
}